package top.lidee.module.clientApi.twice.applet.order;

import java.util.Arrays;
import java.util.Map;


import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;



import top.lidee.common.service.twice.applet.OmsOrderItemService;
import top.lidee.framework.result.PageUtils;
import top.lidee.framework.result.ResponseResult;
import top.lidee.repository.model.twice.pojo.applet.OmsOrderItemEntity;


/**
 * 商品订单项信息
 *
 * @author zhangzhan
 * @email 52194440@qq.com
 * @date 2024-10-17 18:12:08
 */
@Api("商品订单项信息")
@RestController
@RequestMapping("/clientApi/applet/omsorderitem")
public class OmsOrderItemController {
    @Autowired
    private OmsOrderItemService omsOrderItemService;

    /**
     * 列表
     */
    @RequestMapping(value = "/list",method = RequestMethod.POST)
    @ApiOperation(value = "商品订单项信息列表")
    public ResponseResult list(@RequestBody Map<String, Object> params){
        PageUtils page = omsOrderItemService.queryPage(params);

        return ResponseResult.okResultPage("page", page);
    }


    /**
     * 信息
     */
    @RequestMapping(value = "/info/{id}",method = RequestMethod.GET)
    @ApiOperation(value = "商品订单项信息信息")
    public ResponseResult info(@PathVariable("id") Long id){
		OmsOrderItemEntity omsOrderItem = omsOrderItemService.getById(id);

        return ResponseResult.okResultPage("OmsOrderItem", omsOrderItem);
    }

    /**
     * 保存
     */
    @RequestMapping(value = "/save",method = RequestMethod.POST)
    @ApiOperation(value = "商品订单项信息保存")
    public ResponseResult save(@RequestBody OmsOrderItemEntity omsOrderItem){
		omsOrderItemService.save(omsOrderItem);

        return ResponseResult.ok();
    }

    /**
     * 修改
     */
    @RequestMapping(value = "/update",method = RequestMethod.PUT)
    @ApiOperation(value = "商品订单项信息修改")
    public ResponseResult update(@RequestBody OmsOrderItemEntity omsOrderItem){
		omsOrderItemService.updateById(omsOrderItem);

        return ResponseResult.ok();
    }

    /**
     * 删除
     */
    @RequestMapping(value = "/delete",method = RequestMethod.DELETE)
    @ApiOperation(value = "商品订单项信息删除")
    public ResponseResult delete(@RequestBody Long[] ids){
		omsOrderItemService.removeByIds(Arrays.asList(ids));

        return ResponseResult.ok();
    }

}
